package ltd.smallwang.infrastructure.user;

import ltd.smallwang.domain.user.User;
import ltd.smallwang.domain.user.gateway.UserGateway;
import ltd.smallwang.infrastructure.user.db.UserMapper;
import ltd.smallwang.infrastructure.user.db.model.UserPO;
import org.springframework.stereotype.Service;

@Service
public class UserGatewayImpl implements UserGateway {

  private final UserMapper userMapper;

  public UserGatewayImpl(UserMapper userMapper) {
    this.userMapper = userMapper;
  }

  @Override
  public void save(User user) {
    userMapper.insert(UserPO.convertToUserPO(user));
  }
}
